魔兽世界服务端AzerothCore核心Centos系统编译教程

您所在的位置:网站首页 cp name generator怎么下载 魔兽世界服务端AzerothCore核心Centos系统编译教程

魔兽世界服务端AzerothCore核心Centos系统编译教程

2023-05-09 09:06| 来源: 网络整理| 查看: 265

魔兽世界服务端AzerothCore核心Centos系统编译教程

 

大家好,我是艾西今天跟大家分享下用linux系统怎么编译一个自己的魔兽世界服务端

准备工作:服务器一台、 安装软件、下载源码、 地图文件、 修改配置文件

修改文件执行权限、 修改配置文件、编译及启动、编译项目

数据库表修改、游戏测试

(创建GM账户、 客户端登录游戏、GM指令 这几项比较简单不做介绍)

linux系统服务器1台8H16G Centos7 系统服务器能够访问外网

 

安装软件:输入代码指令sudo apt-get update && sudo apt-get install git cmake make gcc g++ clang libmysqlclient-dev libssl -dev libbz2- dev libreadline dev libncurses dev mysql-server libboost- all-dev

 

输入Y等待安装完成就行了

 

输入clang --version 回车

输入cmake - -version回车

输入sudo apt-get install g++-8 gcc-8 回车

 

到这一步我们用于编译魔兽服务端的框架就算安装完成了

(MySQL≥5.7.0、Boost≥1.74、OpenSSL≥1.0.x、CMake≥3.16、Clang≥1.0)

 

核心安装:输入指令git clone xxxxs://github . com/ azerothcore/ azerothcore -wotlk. git --branch master --single-branch azerothcore  (时间较长等待安装完成就好)

如果长时间没有下载安装完成的响应,那么到网站上去下载也是可以的

 

 

下载完成的文件上传到服务器上再手动解压出来输入指令

unzip azerothcore-wotlk-master .zip

 

 

 

 

 

解压完成后就会有一个azerothcore-wotlk-master文件记得把文件名后缀-wotlk-master删掉

 

 

 

服务端编译:

输入指令

cd azerothcore (进入azerothcore文件夹)

mkdir build(创建一个build文件夹)

cd build (进入到build文件)

 

输入指令:

cmake ../

-DCMAKE_INSTALL_PREFIX=$HOME/azeroth-server/ -DCMAKE_C_COMPILER=/usr/bin/clang

-DCMAKE_CXX_COMPILER=/usr/bin/clang++

-DWITH_WARNINGS=1 -DTOOLS_BUILD=all

-DSCRIPTS=static -DMODULES=static(对整个需要编译的文件夹进行整理)

 

nproc --all  (可以看到我们需要编译的核心数量)

 

输入指令make -j 6 (开始编译时间较久耐心等待)

 

 

输入指令:make install 在我们文件目录就能看到azeroth-server文件

 

 

服务器安装:直接准备一个客户端上传到服务器里

 

 

将azeroth-server目录bin文件内的map_extractor、mmaps_ generator、vmap4assembler、vmap4extractor 复制到游戏客户端文件内

输入指令:

cp/home/ubuntu/azeroth-server/bin/map_ extractor /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)

 

cp/home/ubuntu/azeroth-server/bin/mmaps_ generator /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)

 

cp/home/ubuntu/azeroth-server/bin/vmap4_assembler /home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)

 

cp/home/ubuntu/azeroth-server/bin/vmap4_extractor/home /ubuntu/World\ of\ Warcraft\ 3.3.5\ (12340\)

 

 

 

完成后输入指令./map_extractor

输入指令./vmap4_extractor

输入指令./vmap4_assembler Buildings vmaps

输入指令.mkdir mmaps

输入指令./mmaps_generator

以上所有的加载完后会得到4个文件夹

dbc,、maps、 vmaps 、mmaps

将这四个文件夹全部移动到zaeroth-server文件

 

 

 

配置数据库:/home/ubuntu/azeroth -server/etc/ 文件夹内的

authserver.conf.dist(管理用户数据)

worldserver .conf.dist(游戏相关配置文件夹)

 

双击authserver.conf.dist文件用Visual Studio程序打开

 

 

怎么找到我们mysql的用户名和密码呢?

在服务器里输入指令sudo vim /etc/mysql/ debian. cnf

 

 

 

将我们得到的用户名和密码填入下图Visual Studio程序打开的acore位置

 

 

 

修改完后保存,然后打开worldserver .conf.dist文件一样的将acore改为用户名和密码

 

 

创建数据库:输入sudo mysql(进入mysql管理界面)

 

输入命令:source /home/ubuntu/ azerothcore/ data/sql/create/create_ mysql.sql

 

完成输入quit

 

那么到了这里后我们尝试启动一下auth-server和world-server程序 这两个程序需要一直开启运行的,我们可以输入命令单独创建窗口启动

 

screen - s auth

screen - s world

在这两个窗口单独输入命令运行:

cd /home /ubuntu/azeroth- server/bin/

~/azeroth-server/bin$ . /authserver

 

cd /home /ubuntu/azeroth- server/bin/

~/azeroth-server/bin$ . /worldserver

 

 

 

 

 

运行worldserver程序时出现 Map file ' . /maps /0004331.map': does not exist! 报错

 

 

打开worldserver .conf.dist用vs程序打开 搜索data将下图箭头所指位置填入我们的地图路径/home/ubuntu/azeroth-server/data/

 

(就是我们生成的dbc,、maps、 vmaps 、mmaps文件,你们自己在操作的时候这几个文件如果没有放到data文件目录下,那就根据自己说填写的路径去改一下,我这边演示所在的地图路径在/home/ubuntu/azeroth-server/data/)

 

 

 

 

 

再次运行~/azeroth-server/bin$ . /worldserver 就成功跑起来了

 

 

最后就是进行服务器IP配置

 

输入指令$ sudo mysql

输入指令use acore_ auth;

 

输入指令UPDATE realmlist SET address = '[your_ip]' WHERE id = 1;

'[your_ip]'改为你的服务器IP

我这边的是 103.219.xxx.xxx  那么我输入的指令就是

UPDATE realmlist SET address = '[103.219.xxx.xxx]' WHERE id = 1;

在/home/ubuntu/World of Warcraft 3.3.5(12340)目录下的realmlist.wtf文件双击进去用vs打开将表格内的127.0.0.0 改为你的服务器IP即可

 

最后输入exie 到这里我们所有的就算完成了

 

点击wow.exe文件开始和小伙伴一起进入游戏体验测试吧

补注:

无法启动

 网络问题:

如果出现网络问题,无法启动,可参考以下内容修改

 

[root@localhost azerothcore-wotlk]# cat docker-compose.yml

version: '3.2'

 

services:

 

  ac-database:

    image: azerothcore/database

    restart: unless-stopped

    build:

      context: .

      dockerfile: ./docker/database/Dockerfile

    networks:

      proxy:

        ipv4_address: xxx.xxx.xxx.xxx(即你服务器IP地址)

    ports:

      - ${DB_EXTERNAL_PORT:-3306}:3306

    environment:

      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-password}

    volumes:

      - type: volume

        source: ac-database

        target: /var/lib/mysql

 

  ac-worldserver:

    stdin_open: true

    tty: true

    image: azerothcore/worldserver

    restart: unless-stopped

    privileged: true

    build:

      context: ./docker/worldserver

      dockerfile: Dockerfile

    networks:

      proxy:

        ipv4_address: xxx.xxx.xxx.xxx(即你服务器IP地址)

    ports:

      - ${WORLD_EXTERNAL_PORT:-8085}:8085

      - ${SOAP_EXTERNAL_PORT:-7878}:7878

    volumes:

      - type: bind

        source: ./docker/worldserver/bin

        target: /azeroth-server/bin

      - type: bind

        source: ${WORLDSERVER_ETC:-./docker/worldserver/etc}

        target: /azeroth-server/etc

      - type: bind

        source: ${WORLDSERVER_LOGS:-./docker/worldserver/logs}

        target: /azeroth-server/logs

      - type: bind

        source: ${WORLDSERVER_DATA:-./docker/worldserver/data}

        target: /azeroth-server/data

    depends_on:

      - ac-database

 

  ac-authserver:

    image: azerothcore/authserver

    restart: unless-stopped

    build:

      context: ./docker/authserver

      dockerfile: Dockerfile

    networks:

      proxy:

        ipv4_address: xxx.xxx.xxx.xxx(即你服务器IP地址)

    ports:

      - ${AUTH_EXTERNAL_PORT:-3724}:3724

    volumes:

      - type: bind

        source: ./docker/authserver/bin

        target: /azeroth-server/bin

      - type: bind

        source: ${AUTHSERVER_ETC:-./docker/authserver/etc}

        target: /azeroth-server/etc

      - type: bind

        source: ${AUTHSERVER_LOGS:-./docker/authserver/logs}

        target: /azeroth-server/logs

    depends_on:

      - ac-database

 

volumes:

  ac-database:

 

networks:

  proxy:

    ipam:

      config:

      - subnet: xxx.xxx.xxx.xxx(即你服务器IP地址)/24

2.时区问题

如果因为时区问题,无法启动,参考如下修改

 

[root@localhost azerothcore-wotlk]# cat docker/authserver/Dockerfile

FROM ubuntu:20.04

 

# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

# set timezone environment variable

ENV TZ=Asia/Shanghai

 

# set noninteractive mode so tzdata doesn't ask to set timezone on install

ENV DEBIAN_FRONTEND=noninteractive

 

# install the required dependencies to run the authserver

RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev net-tools tzdata;

 

# change timezone in container

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata

 

HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD netstat -lnpt | grep :3724 || exit 1

 

# run the authserver located in the directory "docker/authserver/bin" of the host machine

CMD ["/azeroth-server/bin/authserver"]

[root@localhost azerothcore-wotlk]# cat docker/database/Dockerfile

FROM alpine:3.9 as builder

 

# install bash

RUN apk add --no-cache bash

 

# copy the sources from the host machine

COPY apps /azerothcore/apps

COPY bin /azerothcore/bin

COPY conf /azerothcore/conf

COPY data /azerothcore/data

COPY deps /azerothcore/deps

COPY acore.json /azerothcore/acore.json

 

# run the AzerothCore database assembler

RUN ./azerothcore/bin/acore-db-asm 1

 

FROM mysql:5.7

 

# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

# set timezone environment variable

ENV TZ=Asia/Shanghai

 

ENV LANG C.UTF-8

 

# copy files from the previous build stage - see: xxxxs://docs.docker.com/develop/develop-images/multistage-build/

COPY --from=builder /azerothcore/env/dist/sql /sql

 

# adding the "generate-databases.sh" to the directory "/docker-entrypoint-initdb.d"

# because all scripts included in that directory will automatically be executed when the docker container starts

COPY docker/database/generate-databases.sh /docker-entrypoint-initdb.d

 

HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD ping -h localhost

[root@localhost azerothcore-wotlk]# cat docker/worldserver/Dockerfile

FROM ubuntu:20.04

 

# List of timezones: xxxx://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

# set timezone environment variable

ENV TZ=Aisa/Shanghai

 

# set noninteractive mode so tzdata doesn't ask to set timezone on install

ENV DEBIAN_FRONTEND=noninteractive

 

# install the required dependencies to run the authserver

RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev libreadline-dev net-tools tzdata;

 

# change timezone in container

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata

 

HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=1 CMD netstat -lnpt | grep :8085 || exit 1

 

# run the worldserver located in the directory "docker/worldserver/bin" of the host machine

CMD ["/azeroth-server/bin/worldserver"]

数据库表修改

进入容器,连接数据库

[root@localhost azerothcore-wotlk]# docker exec -it azerothcore-wotlk_ac-database_1 bash

bash-4.2# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1416

Server version: 5.7.41 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql>

打开 acore_auth数据库, realmlist 数据表

mysql> use acore_auth;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

mysql> show tables;

+----------------------+

| Tables_in_acore_auth |

+----------------------+

| account              |

| account_access       |

| account_banned       |

| account_muted        |

| autobroadcast        |

| ip2nation            |

| ip2nationCountries   |

| ip_banned            |

| logs                 |

| logs_ip_actions      |

| realmcharacters      |

| realmlist            |

| uptime               |

| version_db_auth      |

+----------------------+

14 rows in set (0.00 sec)

 

mysql> select * from realmlist;

+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+

| id | name        | address       | localAddress | localSubnetMask | port | icon | flag | timezone | allowedSecurityLevel | population | gamebuild |

+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+

|  1 | AzerothCore | xxx.xxx.xxx.xxx(即你服务器IP地址) | 127.0.0.1    | 255.255.255.0   | 1001 |    0 |    0 |        1 |                    0 |          0 |     12340 |

+----+-------------+---------------+--------------+-----------------+------+------+------+----------+----------------------+------------+-----------+

1 row in set (0.00 sec)

 

address 修改为服务器ip或者域名,port 修改为 1001

update realmlist set address='xxx.xxx.xxx.xxx(即你服务器IP地址)',port='1001';

 

重启服务器

游戏测试

创建GM账户

进入服务器容器,并创建gm账号

 

docker attach azerothcore-wotlk_ac-worldserver_1

 

account create admin 123456

account set gmlevel admin 3 -1

创建完成,quit退出

 

客户端登录游戏

在客户端中,创建 login.bat 文件,并写入如下内容:

 

@echo y | rd /s "Cache"

echo SET realmlist "xxx.xxx.xxx.xxx(即你服务器IP地址):1002"> realmlist.wtf

echo SET realmList "xxx.xxx.xxx.xxx(即你服务器IP地址):1002"> Data/zhCN/realmlist.wtf

echo SET realmList "xxx.xxx.xxx.xxx(即你服务器IP地址):1002"> Data/zhTW/realmlist.wtf

 

ren Data\commoo.MPQ common.MPQ

ren Data\expansioo.MPQ expansion.MPQ

start wow.exe

goto end

:end

 

我是艾西,今天魔兽世界服务端AzerothCore核心Centos系统编译教程就到这里啦,希望对有需要的小伙伴有帮助

拥有一台服务器可以做很多很酷的事情 respect !

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3